﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ContrctPerson.aspx.cs"
    Inherits="PPAP.Web.Supplier.Contrct_Person" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript" language="javascript">

        function edit(id) {
            url = "ContrctPerson.aspx?CID=" + id+"&PID="+<%=PID %>;
//                        PopUpWindow(url, 230, 160, 600, 320);
            window.location.href = url;
        }
        function del(id) {
            if (confirm('Please confirm to delete the person.')) {
                url = "Contrctperson.aspx?deid=" + id+"&PID="+<%=PID %>;
                window.location.href = url;
            }
        }
        function add() {
            url = "ContrctpersonEdit.aspx?PID="+<%=PID %>;
            PopUpWindow(url, 230, 160, 600, 320);
        }
   
        function check() {
            var txtFirstName = document.getElementById("txtFirstName");
            var txtFamilyName = document.getElementById("txtFamilyName");
            var txtEmail = document.getElementById("txtEmail");
            if (txtFirstName.value == "") {
                alert(" 'First Name' for must fill in the item");
                txtFirstName.focus();
                return false;
            }
            if (txtFamilyName.value == "") {
                alert("'Family Name' for must fill in the item");
                txtFamilyName.focus();
                return false;
            }
            if (txtEmail.value == "") {
                alert("'Email' for must fill in the item");
                txtEmail.focus();
                return false;
            }
            var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
            if (!myreg.test(txtEmail.value)) {
                alert('Email format error！');
                return false;
            }


            return confirm('Are you sure you want to save?');
        }
        </script>
</head>
<body style="font-family: Arial, Helvetica, sans-serif;">
    <form id="form1" runat="server">
    <div>
    <fieldset>
        <legend>Basic information</legend>
        <table cellspacing="1" cellpadding="1" width="100%" align="center" border="0">
            <tr class="line-odd">
                <td  align="left" class="titlename" width="25%" style="font-weight:bold; height:28px;">
                    Supplier code
                </td>
                <td  align="left" width="25%">
                    <asp:Label ID="lblSupplierCode" runat="server"></asp:Label>
                </td>
                <td  align="left" width="25%" class="titlename" style="font-weight:bold;">
                    Supplier name
                </td>
                <td  align="left" width="25%">
                    <asp:Label ID="lblSupplierName" runat="server"></asp:Label>
                </td>
            </tr>
            <tr class="line-odd">
                <td  align="left" width="25%" class="titlename" style="font-weight:bold; height:28px;">
                    Plant name
                </td>
                <td  align="left" width="25%">
                    <asp:Label ID="lblPlantName" runat="server"></asp:Label>
                </td>
                <td  align="left" width="25%" class="titlename" style="font-weight:bold;">
                   Main business
                </td>
                <td  align="left" width="25%">
                    <asp:Label ID="lblMainBusiness" runat="server"></asp:Label>
                </td>
            </tr>
        </table>
    </fieldset>
     
     <br />

        <fieldset>
        <legend>User list</legend>
        <asp:GridView ID="GridView1" runat="server" CellPadding="4" Width="100%" ForeColor="#333333"
            GridLines="None" AutoGenerateColumns="False">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:TemplateField HeaderText="SN" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("rownum") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText=" First Name" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("Firstname") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Family Name" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Gender" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="Label5" runat="server" Text='<%# Eval("GENDER") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Position" Visible="false" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("POSTITION") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Email(login account)" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Eval("Email") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Telephone" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="Label6" runat="server" Text='<%# Eval("Telephone") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateField>
                <%--<asp:TemplateField HeaderText="Edit" ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <asp:HyperLink ID="hyperline1" runat="server" ImageUrl="ico/edit.gif" NavigateUrl='Contrct Person.aspx?Cid=<%#Eval("ID") %>'></asp:HyperLink>
            </ItemTemplate>
        </asp:TemplateField>--%>
                <asp:HyperLinkField DataNavigateUrlFields="ID" Visible="false" DataNavigateUrlFormatString="ContrctPerson.aspx?CID={0}"
                    Text="Edit" />
                <asp:TemplateField HeaderText="Edit" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <img src="../Images/newimg/write.png" title="Edit" onclick="<%#"javascript:edit("+Eval("ID")+");" %>" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:HyperLinkField DataNavigateUrlFields="ID" Visible="false" DataNavigateUrlFormatString="Plant.aspx?PID={0}"
                    Text="Edit" />
                <asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" Visible="false" runat="server" OnClientClick="return confirm('Please confirm to delete the file.')"
                            PostBackUrl='<%# "Users.aspx?deid="+Eval("ID") %>'>Delete</asp:LinkButton>
                        <img src="../Images/newimg/delete.png" title="Delete" onclick="<%#"javascript:del("+Eval("ID")+")" %>" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#E7E8E8" Font-Bold="True" Font-Size="12px" ForeColor="Black" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        </fieldset>

        <br />

        <fieldset>
        <legend>User information</legend>
           <table width="100%">
    <tr class="line-odd"><td width="25%" class="titlename" style="height:28px;">
        First
       Name
        </td><td width="25%">
            <asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox><font color='red'>*</font>
        </td><td width="25%" class="titlename">
            Family Name</td><td>
            <asp:TextBox ID="txtFamilyName" runat="server"></asp:TextBox>
            <font color='red'>*</font>
        </td></tr>
    <tr class="line-odd"><td class="titlename" style="height:28px;">
           Gender
        </td><td>
            <asp:RadioButton ID="rbtMale" runat="server" Checked="True" GroupName="sex" 
                Text="male" />
            <asp:RadioButton ID="rbtfemale" runat="server" GroupName="sex" Text="female" />
        </td><td class="titlename">
        Email(login account)</td><td>
            <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
            <font color="red">*</font>
        </td></tr>
    <tr class="line-odd"><td class="titlename" style="height:28px;">
            Telephone
        </td><td>
            <asp:TextBox ID="txtTelephone" runat="server"></asp:TextBox>
        </td><td class="titlename">
            Is manager?</td><td>
            <asp:RadioButton ID="rbtY" runat="server" GroupName="g" Text="Yes" />
            <asp:RadioButton ID="rbtN" runat="server" Checked="True" GroupName="g" 
                Text="No" />
        </td></tr>
        <tr style="display:none;" class="line-odd"><td>Status
        </td><td>
            <asp:RadioButton ID="rbtActive" runat="server" Checked="True" 
                GroupName="status" Text="active" />
            <asp:RadioButton ID="rbtInactive" runat="server" 
                GroupName="status" Text="inactive" />
            </td><td>Position
        </td><td>
            <asp:DropDownList ID="ddlPostition" runat="server">
                <asp:ListItem>Manager</asp:ListItem>
                <asp:ListItem>Admin</asp:ListItem>
            </asp:DropDownList>
            </td></tr>
    <tr><td colspan="4" align="right"><asp:Button ID="Button1" CssClass="button" runat="server" 
            Text="Add" onclick="Button1_Click" 
            onclientclick="return check();" /></td></tr></table>
        </fieldset>
    </div>
    </form>
</body>

</html>
